//
//  FQCerificationInputView.swift
//  SwiftProject
//
//  Created by 董駸 on 2022/8/22.
//

import UIKit

class FQCerificationInputView: UIView {
    
    let nameTF = QMUITextField()
    let idTF = QMUITextField()
    
    convenience init(_ type : Int) {
        self.init(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 144))
        backgroundColor = .white

        let whiteV = UIView()
        whiteV.backgroundColor = .white
        addSubview(whiteV)
        
        whiteV.snp.makeConstraints { make in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(114)
        }
        
        nameTF.placeholder = "请输入本人真实姓名"
        nameTF.font = .rSFont(15)
        whiteV.addSubview(nameTF)
        
        nameTF.snp.makeConstraints { make in
            make.height.equalTo(57)
            make.top.left.right.equalToSuperview()
        }
        
        let nameV = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 57))
        let nameLb = QMUILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 57))
        nameLb.text = "真实姓名"
        nameLb.font = .rSFont(15)
        nameLb.textColor = .color51
        nameLb.textAlignment = .center
        nameV.addSubview(nameLb)
        nameTF.leftView = nameV
        nameTF.leftViewMode = .always
        
        idTF.placeholder = "请输入本人身份证号"
        idTF.font = .rSFont(15)
        idTF.qmui_borderPosition = .top
        idTF.qmui_borderColor = .color238
        idTF.qmui_borderWidth = 0.5
        whiteV.addSubview(idTF)
        
        idTF.snp.makeConstraints { make in
            make.height.equalTo(57)
            make.bottom.left.right.equalToSuperview()
        }
        
        let idV = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 57))
        let idLb = QMUILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 57))
        idLb.text = "身份证号"
        idLb.font = .rSFont(15)
        idLb.textColor = .color51
        idLb.textAlignment = .center
        idV.addSubview(idLb)
        idTF.leftView = idV
        idTF.leftViewMode = .always
        
        if type != 0 {
            qmui_height = 114
        } else {
            let titleLb = QMUILabel(font: .rSFont(15), textColor: .color153)
            titleLb.text = "请确认您的身份信息"
            addSubview(titleLb)
            
            titleLb.snp.makeConstraints { make in
                make.left.equalTo(20)
                make.top.equalToSuperview()
            }
            idTF.isEnabled = false
            nameTF.isEnabled = false
        }
    }
}
